package com.kinghood.productcenter.common.model.enums.base;

import lombok.Getter;

/**
 * 编码规则类型
 *
 * @author jp
 * @date 2023/12/27
 */
@Getter
public enum CodeRuleTypeEnum {
    SERIAL_NUMBER(1, "流水号"),
    CONSTANT(2, "常量"),
    DATE(3, "日期"),
    VARIABLE(4, "变量");

    private Integer type;
    private String name;

    CodeRuleTypeEnum(Integer type, String name) {
        this.type = type;
        this.name = name;
    }

    public static String getNameByType(Integer type) {
        for (CodeRuleTypeEnum myEnum : CodeRuleTypeEnum.values()) {
            if (myEnum.getType().equals(type)) {
                return myEnum.getName();
            }
        }
        return null;
    }
}
